"""
键盘操作
"""
from time import sleep, time
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By


# driver = webdriver.Edge()
driver = webdriver.Chrome()

# 不自动关闭浏览器
option = webdriver.ChromeOptions()
option.add_experimental_option("detach", True)

# 将option作为参数添加到Chrome中
driver = webdriver.Chrome(chrome_options=option)
driver.get('https://www.csdn.net/')



'''
#ele = driver.find_element_by_id('kw')
ele = driver.find_element(By.ID, 'kw')  # 定位网页中id为kw的元素，即百度搜索输入框

ele.send_keys('易烊千玺')
sleep(1)
ele.send_keys(Keys.BACK_SPACE)
sleep(1)
# 组合键 Ctrl + a 全选 ，注意这里的组合键都是小写
ele.send_keys(Keys.CONTROL, 'a')
sleep(1)
ele.send_keys(Keys.CONTROL, 'x')
sleep(1)
ele.send_keys(Keys.CONTROL, 'v')

sleep(3)
driver.quit()
'''
'''
# 不自动关闭浏览器
option = webdriver.EdgeOptions()
option.add_experimental_option("detach",True)
# 将option作为参数添加到Edge中
driver = webdriver.Edge(edge_options=option)
'''




